package broker;

import java.net.MalformedURLException;
import java.net.URI;
import java.rmi.NotBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import broker.BrokerImpl.BrokerEventType;
import broker.BrokerImpl.SubscriptionType;

import common.Link;
import common.PublishInfo;
import common.Subscription;
import common.SubscriptionInfo;
import common.VectorClock;

public interface Broker extends Remote {

	public void addClient(URI uri) throws MalformedURLException,
			RemoteException, NotBoundException, Exception;

	public void beginNetworkReorganization(URI uri, BrokerEventType eventType)
			throws MalformedURLException, RemoteException, NotBoundException,
			RemoteException;

	public void endNetworkReorganization(URI brokerURI,
			BrokerEventType eventType) throws RemoteException;

	public ArrayList<URI> getBrokers() throws RemoteException;

	public ArrayList<Link> getLinkState() throws RemoteException;

	public Hashtable<URI, List<Subscription>> getRemoteSubscriptionsTable()
			throws RemoteException;

	public Hashtable<String, VectorClock> getTopicsVectorClocks()
			throws RemoteException;

	public void ping() throws RemoteException;

	public void publish(PublishInfo pubInfo) throws RemoteException;

	public void removeClient(URI uri) throws Exception, RemoteException;

	public void subscribe(SubscriptionInfo info) throws RemoteException;

	public void updateNetwork(URI uri, BrokerEventType eventType,
			boolean getSubscriptionsTable) throws RemoteException;

	public void updateRoutingTable(ArrayList<Link> spt, URI source)
			throws RemoteException;

	public void updateSubscriptionsTable(SubscriptionInfo info,
			SubscriptionType type, boolean updateVectorClocks)
			throws RemoteException;

	public void updateTopicVectorClocks(SubscriptionInfo info)
			throws RemoteException;

	public void updateTopology(ArrayList<ArrayList<Link>> bidirNetMap)
			throws RemoteException;
}
